package com.blog4j.server.modules.sms.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.blog4j.common.model.Result;
import com.blog4j.server.modules.sms.service.SmsService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 98k灬
 * @version v1.0.0
 * @Description : 功能描述
 * @Create on : 2024/7/29 19:12
 **/
@RestController
@RequestMapping("/api/sms")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class ApiSmsController {
    private final SmsService service;

    /**
     * 获取短信验证码
     *
     * @param phone 手机号码
     * @return 短信验证码
     */
    @SaIgnore
    @GetMapping("/getPhoneCode/{phone}")
    public Result getPhoneCode(@PathVariable("phone") String phone) {
        service.getPhoneCode(phone);
        return Result.ok();
    }
}
